
#include <iostream>
using namespace std;

class Complex {
public:
    Complex();

    Complex(const Complex &);

    Complex(double re, double im);

    friend bool equal(Complex c1, Complex c2);

    //友元函数声明
    void set_real(double re) { real = re; }

    void set_imag(double im) { imag = im; }

    double get_real() { return real; }

    double get_imag() { return imag; }

    void disp() { cout << real << "+" << imag << "i"; }

private:
    double real;
    double imag;
};

Complex::Complex(double re, double im) {
    real = re;
    imag = im;
}

Complex::Complex(const Complex &comp) {
    real = comp.real;
    imag = comp.imag;
}

bool equal(Complex c1, Complex c2) {
    if ((c1.real == c2.real) && (c1.imag == c2.imag))
        return true;
    else
        return false;
}
int main() {
    Complex c1(2, 3), c2(3, 4);
    if (equal(c1, c2))
        cout << "这两个复数相等！" << endl;
    else
        cout << "这两个复数不相等！" << endl;
    return 0;
}